package org.holynite.fieldmanage.entities

import javax.persistence.Column
import javax.persistence.Embeddable

/**
 * Created by midnite on 15/1/14.
 */
@Embeddable
class FieldSchemePK implements Serializable {
	@Column(name = "field_id", nullable = false)
	String fieldId
	@Column(name = "scheme_id", nullable = false)
	String scheme_id

	boolean equals(o) {
		if (this.is(o)) return true
		if (getClass() != o.class) return false

		FieldSchemePK that = (FieldSchemePK) o

		if (fieldId != that.fieldId) return false
		if (scheme_id != that.scheme_id) return false

		return true
	}

	int hashCode() {
		int result
		result = (fieldId != null ? fieldId.hashCode() : 0)
		result = 31 * result + (scheme_id != null ? scheme_id.hashCode() : 0)
		return result
	}
}
